package com.guldan.jaina.provider;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.guldan.core.dubbo.client.ResponseDTO;
import com.guldan.core.search.Pagination;
import com.guldan.jaina.dto.citizenproperty.CitizenPropertyDTO;
import com.guldan.jaina.dto.citizenproperty.CitizenPropertySearchDTO;
import com.guldan.jaina.manager.CitizenPropertyManager;

/**
 * Created by Silas.
 * Date: 2016/11/7
 * Time: 22:54
 */
@Component
public class CitizenPropertyProviderImpl implements ICitizenPropertyProvider {

    @Autowired
    private CitizenPropertyManager citizenPropertyManager;

    @Override
    public ResponseDTO<CitizenPropertyDTO> get(Integer areaId) {
        ResponseDTO<CitizenPropertyDTO> response = new ResponseDTO<>();
        response.setData(citizenPropertyManager.get(areaId));
        return response;
    }

    @Override
    public ResponseDTO<CitizenPropertyDTO> save(CitizenPropertyDTO dto) {
        ResponseDTO<CitizenPropertyDTO> response = new ResponseDTO<>();
        response.setData(citizenPropertyManager.save(dto));
        return response;
    }

    @Override
    public ResponseDTO<Boolean> delete(Integer areaId) {
        ResponseDTO<Boolean> response = new ResponseDTO<>();
        response.setData(citizenPropertyManager.delete(areaId));
        return response;
    }

    @Override
    public ResponseDTO<Pagination<CitizenPropertyDTO>> list(CitizenPropertySearchDTO areaSearchDTO) {
        ResponseDTO<Pagination<CitizenPropertyDTO>> response = new ResponseDTO<>();
        response.setData(citizenPropertyManager.list(areaSearchDTO));
        return response;
    }

}
